#include "subscriber_manager.hpp"
#include <sstream>
#include <boost/uuid/uuid_io.hpp>
#include "subscription.hpp"

namespace fasys{ namespace subscriber{

struct subscription_info
{
  subscribe_id_t subscribe_id;
  time_t lifetime;
  time_t timeout;
  subscription* subscription_ptr;
  std::string subscribe_uuid;
  subscription* operator -> () { return subscription_ptr;}
  subscription_info()
    : subscribe_id(0)
    , lifetime(0)
    , timeout(0)
    , subscription_ptr(0)
  {
  }
};

subscriber_manager::~subscriber_manager()
{
};

subscriber_manager::subscriber_manager()
  : _ran(), _gen( &_ran )
{
  _ran.seed(time(0));
}

void subscriber_manager::publish(const message_notify& cmd)
{
}

void subscriber_manager::publish(const message_list_response& cmd)
{
}

void subscriber_manager::create_subscription(create_subscription_request& request, create_subscription_response& response)
{
  using namespace ::boost;
  using namespace ::boost::uuids;
  std::stringstream ss;
  ss << _gen();
  response.subscribe_uuid = ss.str();
  
}

}}

